package aes.acctest;

import aes.server.QuestionsManager;
import common.*;

import fit.ActionFixture;

public class DeleteQuestion extends ActionFixture{

	private Question q = new Question();
	//get question (value expected) return id
	//delete question return boolean
	public boolean TestDeleteNotExistentQuestion(){//not existent zero id question
		int id=0;
		if(!QuestionsManager.removeQuestion(id))
			return false;
		q=QuestionsManager.getQuestion(id);
		return (q==null);	 
	}
	
	
	public boolean TestDeleteExistentQuestion(){//create new question add to db remove from db get from db return (q==null)
		q=new Question();
		q.setId(11111);
		q.setQuestion("check");
		String[] an={"1","2","3","4"};
		q.setAnswers(an);
		q.setCorrectAnswer(2);
		q.setTeacherId(11);
		QuestionsManager.addQuestion(q);
		if(!QuestionsManager.removeQuestion(q.getId()))
			return false;
		q=QuestionsManager.getQuestion(11111);
		return (q==null);
	}
	
	
}
